{extend name="v1/layout/base"}
{block name="content"}
<div class="layui-row layui-col-space15">
  <div class="layui-col-md12">
    <form class="layui-card-body layui-form layui-form-pane">
      <!-- 需要购买的物品 -->
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">基础信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">关联订单编号：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.sub_order_sn}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">退款单号：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.refund_order_sn}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">审核状态：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.status_txt}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">支付方式：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.pay_type}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">支付状态：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.pay_status}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">售后类型：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.type_txt}"  autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">货物状态：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info['is_get_goods']==1?'未收到货':'已收到货'}"  autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">申请原因：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info['reason']}"  autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">申请备注：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info['content']}"  autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      {if condition="$info.return_reason_picarr != ''"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">申请退款图片：</label>
            <div class="layui-input-block">
              {volist name="$info.return_reason_picarr" id="volist"}
              <div class="xk-big-show" style="float:left;margin-right:10px;" datasrc="{$volist}">
                <img class="layui-upload-img  xk-img" id="img-show-1" src="{$volist}" width="100px" height="100px">
              </div>
              {/volist}
            </div>
        </div>
      </div>
      {/if}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">收货人信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">姓名：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.name}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">电话：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.tel}" class="layui-input">
          </div>
        </div>
      </div>
      {if condition="$info['shipping_type'] eq 1"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">收货地址：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.province}{$info.city}{$info.area}{$info.address}"  autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">产品信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">产品缩略图：</label>
          <div class="layui-input-block">
            <div class="layui-upload">
              <div class="xk-big-show" datasrc="{$info['goods_pic']?$info['goods_pic']:'__COMMON__images/no_pic.png'}">
                <img class="layui-upload-img  xk-img" id="img-show-1" src="{$info['goods_pic']?$info['goods_pic']:'__COMMON__images/no_pic.png'}" width="100px" height="100px">
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">产品名称：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.goods_name}"  autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      {if condition="$info['spec_value']"}
      <div class="layui-row layui-col-space10 layui-form-item" >
        <div class="layui-col-lg8">
          <label class="layui-form-label">产品规格：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.spec_value}" autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">产品单价：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.goods_price}" autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">购买数量：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.buy_num}" autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      <!-- 财务信息 -->
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">财务信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg4">
          <label class="layui-form-label">商品总金额(不含运费)：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.goods_sub_total}" class="layui-input">
          </div>
        </div>
        <div class="layui-col-lg4">
          <label class="layui-form-label">关联订单编号：</label>
          <div class="layui-input-block">
              <input type="text" disabled="disabled" autocomplete="off" value="{$info.sub_order_sn}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg4">
          <label class="layui-form-label">审核退款金额：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.refund_want_price}" class="layui-input">
          </div>
        </div>
        <div class="layui-col-lg4">
          <label class="layui-form-label">退款到账金额：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.refund_price}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg4">
          <label class="layui-form-label">商品运费：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.goods_freight}" class="layui-input">
          </div>
        </div>
        <div class="layui-col-lg4">
          <label class="layui-form-label">是否整单售后：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.order_status_show}" class="layui-input">
          </div>
        </div>
      </div>
      <!-- 物流时间 -->
      {if condition="$info['company_code'] != ''"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">买家物流
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">物流公司：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.company_name}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">物流单号：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.company_num}"  class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">快递联系人：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.company_tel}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <!-- 时间线 -->
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">时间信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">下单时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.show_create_time}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">付款时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.show_pay_time}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">申请售后时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.create_time}" class="layui-input">
          </div>
        </div>
      </div>
      {if condition="$info['check_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">审核处理时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.check_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['deliver_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">买家发货时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.deliver_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['finish_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">售后完成：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.finish_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['delete_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">取消时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.delete_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}

      {if condition="$info['apply_reason']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">驳回原因：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.apply_reason}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">操作
          <hr class="layui-border-red">
        </div>
      </div>
      <!-- 修改订单状态订单改价  -->
      <!-- 底部操作按钮 -->
      <div class="layui-row">
        <div class="layui-col-xs2">&nbsp;</div>
        <div class="layui-col-xs5">
          <input type="hidden" name="sub_order_sn" value="{$info.sub_order_sn}">
          <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" id="backList"><i class="layui-icon">&#xe65c;</i>返回列表</button>
          {if condition="$info['type'] == 1"}
            {if condition="$info['status'] == 0"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="makeSurePayRefund"><i class="layui-icon">&#xe609;</i>同意退款</button>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-radius" lay-submit lay-filter="refusePayRefund"><i class="layui-icon">&#xe609;</i>拒绝退款</button>
            {elseif condition="$info['status'] == 1.4 || $info['status'] == 1.1"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="doDelivery"><i class="layui-icon">&#xe609;</i>重新执行退款</button>
            {/if}
          {elseif condition="$info['type'] == 2"}
          {if condition="$info['status'] == 0"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="makeSureReturnRefund"><i class="layui-icon">&#xe609;</i>同意退货</button>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-radius"  lay-submit lay-filter="refusePayReturnRefund"><i class="layui-icon">&#xe609;</i>拒绝退货</button>
          {elseif condition="$info['status'] == 2.1"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="createCompanyInfoRefund"><i class="layui-icon">&#xe609;</i>填写回寄物流</button>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-radius" lay-submit lay-filter="refusePayReturnRefund"><i class="layui-icon">&#xe609;</i>驳回退货</button>
          {elseif condition="$info['status'] == 2.3"}
          <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="makeSurePayReturnRefund"><i class="layui-icon">&#xe609;</i>确认退货完成</button>
          <button type="button" class="layui-btn layui-btn-danger layui-btn-radius" lay-submit lay-filter="refusePayReturnRefund"><i class="layui-icon">&#xe609;</i>驳回退货</button>
          {elseif condition="$info['status'] == 1.4"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="doDelivery"><i class="layui-icon">&#xe609;</i>重新执行退款</button>
          {/if}
          {elseif condition="$info['type'] == 3"}
          {if condition="$info['status'] == 0"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="makeSureReturnGoods"><i class="layui-icon">&#xe609;</i>同意换货</button>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-radius"  lay-submit lay-filter="refusePayReturnGoods"><i class="layui-icon">&#xe609;</i>拒绝换货</button>
          {elseif  condition="$info['status'] == 3.1"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="createCompanyInfoReturn"><i class="layui-icon">&#xe609;</i>填写回寄物流</button>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-radius"  lay-submit lay-filter="refusePayReturnGoods"><i class="layui-icon">&#xe609;</i>驳回换货</button>
          {elseif condition="$info['status'] == 3.3"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="overSureRefundGoods"><i class="layui-icon">&#xe609;</i>确认换货完成</button>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-radius"  lay-submit lay-filter="refusePayReturnGoods"><i class="layui-icon">&#xe609;</i>驳回换货</button>
          {/if}
          {/if}
          {if condition="$info['company_num'] != ''"}
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="searchaShipping"><i class="layui-icon">&#xe609;</i>查看回寄物流</button>
          {/if}
        </div>
        <div class="layui-col-xs5">&nbsp;</div>
      </div>
      <!-- 底部操作按钮结束 -->
    </form>
  </div>
</div>
{/block}
{block name="myScript"}
<style>
  .oshow_logistics {
  background: #fff;
  padding: 15px 30px 30px 35px;
}

.logistics_title {
  font-size: 16px;
  color: #000000;
}

.oshow_logistics ul {
  margin-top: 18px;
}

.oshow_logistics ul::-webkit-scrollbar {
  width: 8px;
  height: 1px;
}

.oshow_logistics ul::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: #f87924;
}

.oshow_logistics ul::-webkit-scrollbar-track {
  border-radius: 8px;
  background: #e5e5e5;
}

.oshow_logistics li {
  display: flex;
  min-height: 72px;
}

.logistics_time {
  width: 185px;
  font-size: 14px;
  line-height: 20px;
  color: #666;
  padding-top: 3px;
  padding-right: 20px;
}

.logistics_hr {
  width: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logistics_hr img {
  width: 25px;
  height: 25px;
}

.logistics_hr span {
  flex: 1;
  overflow: hidden;
  border-right: 1px solid #d7d7d7;
}

.logistics_text {
  flex:1;
  overflow: hidden;
  padding-bottom: 30px;
  padding-top: 3px;
  font-size: 16px;
  line-height: 22px;
  color: #666666;
}

.logistics_active .logistics_time,
.logistics_active .logistics_text {
  color: #1a74fa;
}

.oshow_logistics li:last-of-type {
  min-height: auto;
}

.oshow_logistics li:last-of-type .logistics_hr span {
  display: none;
}

.oshow_logistics li:last-of-type .logistics_text {
  padding-bottom: 0;
}
</style>
<script>
  layui.use(['form'], function() {
    var form = layui.form,
      layer = layui.layer,
      $ = layui.$;
    form.on('submit(searchaShipping)',function(data){
      var  company_num = '{$info.company_num}',
           tel = '{$info.company_tel}',
          url = "/{:config("manage.manage_name")}/{:config("manage.version")}/Order/searchShipping"
      https(url,{company_num: company_num,tel:tel},'post',0,'查询物流数据').then(res=>{
          if(res.resultData.length > 0){
            var html = '<div class="oshow_logistics"><ul>';
                res.resultData.forEach((item, i) => {
                   html += '<li><div class="logistics_time"><div>'+item.time+'</div></div><div class="logistics_text">'+item.content+'</div></li>';
                });
                html += '</ul></div>';
            var index = layer.open({
              type: 1,
              title: '查询物流',
              shadeClose: true,
              shade: 0.2,
              maxmin: true,
              area: ['800px', '400px'],
              content: html,
              success: function(layero, index) {
              },
              yes: function(index, layero) {
              },
              btn2: function() {

              }
            });
          }else{
            xkInfoMsg("暂无物流数据");
          }
      })
    })
    // 同意退款
    form.on('submit(makeSurePayRefund)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/makeSureRefundPay')}",
          refund_check_price = '{$info.refund_want_price}',
          html =
            '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"></div><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg12"><label class="layui-form-label">退款金额：</label><div class="layui-input-block"><input name="name" id="refund_check_price" disabled="disabled" value="'+refund_check_price+'" class="layui-input" /></div></div></div></div></div></div></div>';
          //询问框
          var showx = layer.open({
            type: 1,
            title: '请仔细核对编号为'+refund_order_sn+'的售后申请退款金额吗？',
            shadeClose: true,
            shade: false,
            maxmin: true,
            area: ['600px', '300px'],
            btn: ['确认', '取消'],
            content: html,
            success: function(layero, index) {

            },
            yes: function(index, layero) {
              var refund_check_price = $("#refund_check_price").val();
              if(refund_check_price == ''){
                layer.msg('请核对退款金额');
                return false;
              }
              https(url, {
                refund_check_price: refund_check_price,
                refund_order_sn: refund_order_sn
              }, 'post', 1, '正在执行退款').then(res => {
                xkInfoMsg(res.result_msg);
                setTimeout(function() {
                  layer.close(showx);
                }, 1500)
              })
            },
            btn2: function() {
              layer.close(showx);
            }
          });
    })
    // 同意退货
    form.on('submit(makeSureReturnRefund)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/makeSureReturnRefund')}";
      layer.msg('您确定要同意售后编号为'+refund_order_sn+'的订单进行退货吗？', {
        time: 0,
        btn: ['确定', '取消'],
        yes: function(index) {
          layer.close(index);
          https(url, {
            refund_order_sn: refund_order_sn
          }, 'post', true, '正在处理售后申请').then(res => {
            if (res.result_code == 200) {
              xkInfoMsg(res.result_msg);
            }
          })
        },
        btn2: function(index) {
          layer.close(index);
        }
      });
    })
    // 同意换货
    form.on('submit(makeSureReturnGoods)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/makeSureReturnGoods')}";
      layer.msg('您确定要同意售后编号为'+refund_order_sn+'的订单进行换货处理吗？', {
        time: 0,
        btn: ['确定', '取消'],
        yes: function(index) {
          layer.close(index);
          https(url, {
            refund_order_sn: refund_order_sn
          }, 'post', true, '正在处理同意换货处理').then(res => {
            if (res.result_code == 200) {
              xkInfoMsg(res.result_msg);
            }
          })
        },
        btn2: function(index) {
          layer.close(index);
        }
      });
    })
    // 拒绝退款
    form.on('submit(refusePayRefund)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/refuseRefund')}",
          html =
            '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"></div><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">拒绝原因：</label><div class="layui-input-block"><input name="name" id="apply_reason" class="layui-input" /></div></div></div></div></div></div></div>';
          //询问框
          var showx = layer.open({
            type: 1,
            title: '您确定要驳回编号为'+refund_order_sn+'的售后申请吗？',
            shadeClose: true,
            shade: false,
            maxmin: true,
            area: ['900px', '400px'],
            btn: ['确认', '取消'],
            content: html,
            success: function(layero, index) {

            },
            yes: function(index, layero) {
              var apply_reason = $("#apply_reason").val();
              if(apply_reason == ''){
                layer.msg('请输入驳回原因');
                return false;
              }
              https(url, {
                apply_reason: apply_reason,
                refund_order_sn: refund_order_sn
              }, 'post', 1, '正在执行审核驳回').then(res => {
                xkInfoMsg(res.result_msg);
                setTimeout(function() {
                  layer.close(showx);
                }, 1500)
              })
            },
            btn2: function() {
              layer.close(showx);
            }
          });
    })
    // 拒绝退货
    form.on('submit(refusePayReturnRefund)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/refuseRefund')}",
          html =
            '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"></div><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">拒绝原因：</label><div class="layui-input-block"><input name="name" id="apply_reason" class="layui-input" /></div></div></div></div></div></div></div>';
          //询问框
          var showx = layer.open({
            type: 1,
            title: '您确定要驳回编号为'+refund_order_sn+'的售后申请吗？',
            shadeClose: true,
            shade: false,
            maxmin: true,
            area: ['900px', '400px'],
            btn: ['确认', '取消'],
            content: html,
            success: function(layero, index) {

            },
            yes: function(index, layero) {
              var apply_reason = $("#apply_reason").val();
              if(apply_reason == ''){
                layer.msg('请输入驳回原因');
                return false;
              }
              https(url, {
                apply_reason: apply_reason,
                refund_order_sn: refund_order_sn,
                type: 2
              }, 'post', 1, '正在执行审核驳回').then(res => {
                xkInfoMsg(res.result_msg);
                setTimeout(function() {
                  layer.close(showx);
                }, 1500)
              })
            },
            btn2: function() {
              layer.close(showx);
            }
          });
    })
    // 拒绝换货
    form.on('submit(refusePayReturnGoods)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/refuseRefund')}",
          html =
            '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"></div><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">拒绝原因：</label><div class="layui-input-block"><input name="name" id="apply_reason" class="layui-input" /></div></div></div></div></div></div></div>';
          //询问框
          var showx = layer.open({
            type: 1,
            title: '您确定要驳回编号为'+refund_order_sn+'的售后申请吗？',
            shadeClose: true,
            shade: false,
            maxmin: true,
            area: ['900px', '400px'],
            btn: ['确认', '取消'],
            content: html,
            success: function(layero, index) {

            },
            yes: function(index, layero) {
              var apply_reason = $("#apply_reason").val();
              if(apply_reason == ''){
                layer.msg('请输入驳回原因');
                return false;
              }
              https(url, {
                apply_reason: apply_reason,
                refund_order_sn: refund_order_sn,
                type: 3
              }, 'post', 1, '正在执行审核驳回').then(res => {
                xkInfoMsg(res.result_msg);
                setTimeout(function() {
                  layer.close(showx);
                }, 1500)
              })
            },
            btn2: function() {
              layer.close(showx);
            }
          });
    })
    // 执行收货 同意退款
    form.on('submit(makeSurePayReturnRefund)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/makeSureRefundPay')}",
          refund_check_price = '{$info.refund_want_price}',
          html =
            '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"></div><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg12"><label class="layui-form-label">退款金额：</label><div class="layui-input-block"><input name="name" disabled="disabled" id="refund_check_price" value="'+refund_check_price+'" class="layui-input" /></div></div></div></div></div></div></div>';
          //询问框
          var showx = layer.open({
            type: 1,
            title: '请仔细核对编号为'+refund_order_sn+'的售后申请退款金额吗？',
            shadeClose: true,
            shade: false,
            maxmin: true,
            area: ['600px', '300px'],
            btn: ['确认', '取消'],
            content: html,
            success: function(layero, index) {

            },
            yes: function(index, layero) {
              var refund_check_price = $("#refund_check_price").val();
              if(refund_check_price == ''){
                layer.msg('请核对退款金额');
                return false;
              }
              https(url, {
                refund_check_price: refund_check_price,
                refund_order_sn: refund_order_sn,
                type: 2
              }, 'post', 1, '正在执行退款').then(res => {
                xkInfoMsg(res.result_msg);
                setTimeout(function() {
                  layer.close(showx);
                }, 1500)
              })
            },
            btn2: function() {
              layer.close(showx);
            }
          });
    })
    // 填写退货 回寄物流
    form.on('submit(createCompanyInfoRefund)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/createCompany')}",
          html =
            '<div class="layui-row layui-col-space15">'+
            '<div class="layui-col-md12">'+
            '<div class="layui-card-body layui-form layui-form-pane">'+
              '<div class="layui-row layui-col-space12 layui-form-item">'+
                '<div class="layui-col-lg12">'+
                  '<label class="layui-form-label">回寄物流单号：</label>'+
                  '<div class="layui-input-block">'+
                    '<input id="company_num" value="" class="layui-input" />'+
                  '</div>'+
                '</div>'+
              '</div>'+
              '<div class="layui-row layui-col-space12 layui-form-item">'+
                '<div class="layui-col-lg12">'+
                  '<label class="layui-form-label">回寄联系电话(顺丰必填)：</label>'+
                  '<div class="layui-input-block">'+
                    '<input id="company_tel" value="" class="layui-input" />'+
                  '</div>'+
                '</div>'+
              '</div>'+
            '</div>'+
            '</div>'+
            '</div>';
          //询问框
          var showx = layer.open({
            type: 1,
            title: '请填写编号为'+refund_order_sn+'的售后申请的回寄物流信息',
            shadeClose: true,
            shade: false,
            maxmin: true,
            area: ['600px', '300px'],
            btn: ['确认', '取消'],
            content: html,
            success: function(layero, index) {

            },
            yes: function(index, layero) {
              var company_num = $("#company_num").val();
              var compnay_tel = $("#compnay_tel").val();
              if(company_num == ''){
                layer.msg('请填写回寄物流单号');
                return false;
              }
              https(url, {
                company_num: company_num,
                company_tel: compnay_tel,
                refund_order_sn: refund_order_sn,
                status: '2.3',
              }, 'post', 1, '正在提交回寄物流').then(res => {
                xkInfoMsg(res.result_msg);
                setTimeout(function() {
                  layer.close(showx);
                }, 1500)
              })
            },
            btn2: function() {
              layer.close(showx);
            }
          });
    })
    // 填写换货回寄物流
    form.on('submit(createCompanyInfoReturn)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/createCompany')}",
          html =
            '<div class="layui-row layui-col-space15">'+
            '<div class="layui-col-md12">'+
            '<div class="layui-card-body layui-form layui-form-pane">'+
              '<div class="layui-row layui-col-space12 layui-form-item">'+
                '<div class="layui-col-lg12">'+
                  '<label class="layui-form-label">回寄物流单号：</label>'+
                  '<div class="layui-input-block">'+
                    '<input id="company_num" value="" class="layui-input" />'+
                  '</div>'+
                '</div>'+
              '</div>'+
              '<div class="layui-row layui-col-space12 layui-form-item">'+
                '<div class="layui-col-lg12">'+
                  '<label class="layui-form-label">回寄联系电话(顺丰必填)：</label>'+
                  '<div class="layui-input-block">'+
                    '<input id="company_tel" value="" class="layui-input" />'+
                  '</div>'+
                '</div>'+
              '</div>'+
            '</div>'+
            '</div>'+
            '</div>';
          //询问框
          var showx = layer.open({
            type: 1,
            title: '请填写编号为'+refund_order_sn+'的售后申请的回寄物流信息',
            shadeClose: true,
            shade: false,
            maxmin: true,
            area: ['600px', '300px'],
            btn: ['确认', '取消'],
            content: html,
            success: function(layero, index) {

            },
            yes: function(index, layero) {
              var company_num = $("#company_num").val();
              var compnay_tel = $("#compnay_tel").val();
              if(company_num == ''){
                layer.msg('请填写回寄物流单号');
                return false;
              }
              https(url, {
                company_num: company_num,
                company_tel: compnay_tel,
                refund_order_sn: refund_order_sn,
                status: '3.3',
              }, 'post', 1, '正在提交回寄物流').then(res => {
                xkInfoMsg(res.result_msg);
                setTimeout(function() {
                  layer.close(showx);
                }, 1500)
              })
            },
            btn2: function() {
              layer.close(showx);
            }
          });
    })
    // 同意退货
    form.on('submit(overSureRefundGoods)',function(data){
      var refund_order_sn = '{$info.refund_order_sn}',
          url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Order/overSureRefundGoods')}";
      layer.msg('您确定要完成售后编号为'+refund_order_sn+'的订单处理吗？', {
        time: 0,
        btn: ['确定', '取消'],
        yes: function(index) {
          layer.close(index);
          https(url, {
            refund_order_sn: refund_order_sn
          }, 'post', true, '正在处理完成换货').then(res => {
            if (res.result_code == 200) {
              xkInfoMsg(res.result_msg);
            }
          })
        },
        btn2: function(index) {
          layer.close(index);
        }
      });
    })
  });

</script>
{/block}
